package com.amikomgamedev.labirinhantu.text;

import org.andengine.engine.camera.hud.HUD;
import org.andengine.entity.scene.Scene;
import org.andengine.opengl.font.Font;
import org.andengine.opengl.font.FontFactory;
import org.andengine.opengl.font.FontManager;
import org.andengine.opengl.texture.TextureManager;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import org.andengine.ui.activity.BaseGameActivity;

import com.amikomgamedev.labirinhantu.Utils;
import com.amikomgamedev.labirinhantu.game.Game_Data;
import com.amikomgamedev.labirinhantu.grafik.Grafik_Data;
import com.amikomgamedev.labirinhantu.grafik.Grafik_Detach;

import android.content.Context;
import android.content.res.AssetManager;

public class Text_Load implements Text_Data, Text_Define, Text_Data_Path, Game_Data
{
	protected BaseGameActivity	m_Activity;
	protected Scene				m_Scene;
	protected HUD				m_Hud;
	protected Grafik_Detach		grafik;

	protected Font				fnt_Small, fnt_Medium
//	, fnt_Big
	;

	public Text_Load(Context con, Scene scene, HUD hud, Grafik_Detach graf)
	{
		m_Activity = (BaseGameActivity) con;
		m_Scene = scene;
		m_Hud = hud;
		grafik = graf;
	}

	protected TextureManager getTextMan()
	{
		return m_Activity.getTextureManager();
	}

	protected FontManager getFontMan()
	{
		return m_Activity.getFontManager();
	}

	protected AssetManager getAssetMan()
	{
		return m_Activity.getAssets();
	}

	protected VertexBufferObjectManager getVbo()
	{
		return m_Activity.getVertexBufferObjectManager();
	}

	public void loadFontSmall()
	{

		if (fnt_Small != null)
			return;
		Utils.TRACE("load font small");
		fnt_Small = FontFactory.createFromAsset(getFontMan(), getTextMan(), TEX_TEKS_WIDTH, TEX_TEKS_HEIGHT,
				getAssetMan(), FOLDER_FONT, FONT_SIZE_SMALL, true, android.graphics.Color.WHITE);

		fnt_Small.load();

	}

	public void loadFontMedium()
	{
		if (fnt_Medium != null)
			return;
		Utils.TRACE("load font medium");
		
		if (FONT_SIZE_MEDIUM > 38)
        		fnt_Medium = FontFactory.createFromAsset(getFontMan(), getTextMan(), TEX_TEKS_WIDTH * 2, TEX_TEKS_HEIGHT * 2,
        				getAssetMan(), FOLDER_FONT, FONT_SIZE_MEDIUM, true, android.graphics.Color.RED);
		else
        		fnt_Medium = FontFactory.createFromAsset(getFontMan(), getTextMan(), TEX_TEKS_WIDTH, TEX_TEKS_HEIGHT,
        				getAssetMan(), FOLDER_FONT, FONT_SIZE_MEDIUM, true, android.graphics.Color.RED);
		    

		fnt_Medium.load();
	}

//	public void loadFontBig()
//	{
//		if (fnt_Big != null)
//			return;
//		Utils.TRACE("load font big");
//		fnt_Big = FontFactory.createFromAsset(getFontMan(), getTextMan(), TEX_TEKS_WIDTH, TEX_TEKS_HEIGHT,
//				getAssetMan(), FOLDER_FONT, FONT_SIZE_BIG, true, android.graphics.Color.BLACK);
//
//		fnt_Big.load();
//	}

}